# $Id: PKGBUILD 74420 2012-07-28 01:55:48Z ebelanger $
# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Jan Krňávek <wamba@centrum.cz>

pkgname=man-pages-cs
pkgver=0.18.20090209
pkgrel=4
pkgdesc="Czech man pages"
arch=('any')
url="http://sweb.cz/tropikhajma/man-pages-cs/"
license=('custom')
depends=('man-db')
makedepends=('xz')
source=(http://tropikhajma.sweb.cz/$pkgname/$pkgname-$pkgver.tar.lzma)
# old, not working sources: source=(http://odplata.ic.cz/$pkgname-$pkgver.tar.bz2)
# source=(ftp://man-pages-cs-wiki.homelinux.net/$pkgname/$pkgname-$pkgver.tar.bz2)
md5sums=('ce0f9e3a6fe2de5c260d0034bd6ea74a')

package() {
  tar xfa ${srcdir}/$pkgname-$pkgver.tar.lzma

  cd ${srcdir}/$pkgname-$pkgver

  #removing conflicting files
  rm ${srcdir}/$pkgname-$pkgver/procps/{kill.1,uptime.1}
  rm ${srcdir}/$pkgname-$pkgver/coreutils/man/{groups.1,du.1}
  rm ${srcdir}/$pkgname-$pkgver/man-pages/man1/{dir.1,vdir.1}
  rm ${srcdir}/$pkgname-$pkgver/man-pages/man5/passwd.5

  #installing files
  install -d ${pkgdir}/usr/share/man/cs/man{1,2,3,4,5,6,7,8}
  find . -name '*.1' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man1
  find . -name '*.2' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man2
  find . -name '*.3' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man3
  find . -name '*.4' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man4
  find . -name '*.5' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man5
  find . -name '*.6' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man6
  find . -name '*.7' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man7
  find . -name '*.8' -not -path '*.pc*' -print0 | xargs -r -0 install -m 644 -t ${pkgdir}/usr/share/man/cs/man8

  #licenses
  install -D -m644 ${srcdir}/$pkgname-$pkgver/README \
    ${pkgdir}/usr/share/licenses/$pkgname/README
  install -D -m644 ${srcdir}/$pkgname-$pkgver/CONTRIB \
    ${pkgdir}/usr/share/licenses/$pkgname/CONTRIB
}
